package cn.yyh.servicePet.controller;

import cn.yyh.commons.utils.R;
import cn.yyh.servicePet.domain.PetDetail;
import cn.yyh.servicePet.service.IPetDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 杨永航
 * @version 1.0
 * @Title: PetDetailController
 * @Package: cn.yyh.servicePet.controller
 * @date 2021/7/13
 */
@RestController
@RequestMapping("/servicePet/petDetail")
public class PetDetailController {
    @Autowired
    private IPetDetailService petDetailService;

    @GetMapping("{id}")
    public R getDetail(@PathVariable Long id) {
        try {
            PetDetail detail = petDetailService.getByPetId(id);
            return R.oK().data("detail",detail);
        } catch (Exception e) {
            e.printStackTrace();
            return R.error();
        }
    }
}
